<template>
<el-dialog title="详细信息" :visible.sync="accountsVisable" append-to-body>
    <el-table
      :data="tableData"
      style="width: 100%"
      border
      show-overflow-tooltip
    >
    <el-table-column
      prop="leixtype"
      label="类型"
    ></el-table-column>
      <el-table-column
        prop="cname"
        label="科目"
      >
      </el-table-column>


      <el-table-column
        prop="shopname"
        label="商品名称"
      >
      </el-table-column>

      <el-table-column
        prop="number"
        label="数量"
      >
      </el-table-column>
      <el-table-column
        prop="money"
        label="金额"
      >
      </el-table-column>
      <el-table-column
        prop="username"
        label="创建人"
      >
      </el-table-column>
      <el-table-column
        prop="creatime"
        label="发生时间"
        width="100px"

      >
      </el-table-column>

  </el-table>
      <el-pagination
      @size-change="sizeChangeHandle"
      @current-change="currentChangeHandle"
      :current-page="pageIndex"
      :page-sizes="[5,10, 20, 50, 100]"
      :page-size="pageSize"
      :total="totalPage"
      layout="total, sizes, prev, pager, next, jumper"
    ></el-pagination>
</el-dialog>

</template>

<script>
  export default {
    data() {
      return {
        accountsVisable:false,
        tableData: [],
        payTypeMap: {
            0: ['预收款账', 'success', '', 'ruSysNo'],
            1: ['信用卡授权', 'success', '', 'ruSysNo'],
            2: ['消费', 'success', '', 'ruSysNo'],
            4: ['房费', 'success', '', 'ruSysNo'],
            5: ['预收退款', 'danger', '-', 'refundNo'],
            6: ['结账收款', 'success', '', 'ruSysNo'],
            7: ['结账退款', 'danger', '-', 'refundNo'],
            3: ['押金收款', 'success', '', 'ruSysNo'],
            8: ['押金退款', 'danger', '-', 'refundNo'],
            9: ['红冲', 'danger', '-', 'refundNo']
        },
        totalPage:0,
        pageIndex : 1,
        pageSize : 5,
        type:'',
        nowType:'',
        startTime:'',
        id:'',
        endTime:''
      }
    },
    methods:{
        init(startTime,endTime,id) {
            this.accountsVisable = true
            this.startTime = startTime
            this.endTime = endTime
            this.id = id
            this.pageSize = 5
            this.pageIndex = 1
            this.getData(startTime,endTime,id);
        },

        getData(startTime,endTime,id) {
          this.$http({
          url: this.$http.adornUrl('/hotel/thotelfloorroomcheckinaccounting/getcommodityByid'),
          method: 'get',
          params: this.$http.adornParams({
            page: this.pageIndex,
            limit: this.pageSize,
             id: this.id,
            startTime: this.startTime,
            endTime: this.endTime
          })
        }).then(({ data }) => {

          if (data && data.code === 0) {
            console.log(data)
            this.tableData = data.page.records
            this.totalPage = data.page.total;
          } else {

          }
        })
      },
      // 每页数
    sizeChangeHandle (val) {
      this.pageSize = val;
      this.pageIndex = 1;
      this.getData();
    },
    // 当前页
    currentChangeHandle (val) {
      this.pageIndex = val;
      this.getData();
    }
    }
  }
</script>
